<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title></title>

  <style type="text/css">
    html,
    body {
      width: 100%;
      height: 100%;
      margin: 0;
      padding: 0;
      overflow: hidden;
    }

    #map {
      width: 100%;
      height: 100%;
    }
  </style>
</head>

<body>

<div id="map"></div>
<canvas id="canvas"></canvas>

<script type="text/javascript" src="//api.map.baidu.com/api?v=3.0&ak=baiduKey"></script>
<script type="text/javascript" src="../../js/mapv.js"></script>

<script type="text/javascript">
  // 百度地图API功能
  var map = new BMap.Map("map", {
    enableMapClick: false
  }); // 创建Map实例
  map.centerAndZoom(new BMap.Point(105.403119, 38.028658), 5); // 初始化地图,设置中心点坐标和地图级别
  map.enableScrollWheelZoom(true); // 开启鼠标滚轮缩放

  map.setMapStyle({
    style: 'midnight'
  });

  var randomCount = 30;

  var data = [];

  var citys = ["北京", "天津", "上海", "重庆", "石家庄", "太原", "呼和浩特", "哈尔滨", "长春", "沈阳", "济南", "南京", "合肥", "杭州", "南昌", "福州", "郑州", "武汉", "长沙", "广州", "南宁", "西安", "银川", "兰州", "西宁", "乌鲁木齐", "成都", "贵阳", "昆明", "拉萨", "海口"];

  // 构造数据
  while (randomCount--) {
    var cityCenter = mapv.utilCityCenter.getCenterByCityName(citys[parseInt(Math.random() * citys.length)]);
    data.push({
      geometry: {
        type: 'Point',
        coordinates: [cityCenter.lng - 2 + Math.random() * 4, cityCenter.lat - 2 + Math.random() * 4]
      },
      text: '￥' + (Math.random() * 10).toFixed(2)
    });
  }
  var dataSet = new mapv.DataSet(data);

  var options = {
    draw: 'text',
    avoid: true,
    size: 12,
    font: '18px Arial',
    fillStyle: 'yellow',
    shadowColor: 'yellow',
    shadowBlur: 10
  }

  var mapvLayer = new mapv.baiduMapLayer(map, dataSet, options);
</script>

</body>

</html>
